/*
 * @(#)Theme.java        0.1 09/04/29
 * @version 	0.1 29 Apr 2009
 * @author 	Do Van Khang
 * 
 * Doc cac icon cho menu va toolbar
 */


package Themes;

import javax.swing.*;
import GUI.*;



public class Theme {
	static String currentTheme;
	private String imageExtension;
	private static Theme instance = new Theme(Options.getCurrentTheme().getFolder());
	public static Theme getInstance() {
		return instance;
	}
	protected Theme(String theme) {
		currentTheme = theme;
		imageExtension = ".png";
	}
	
	/*
	 * Tra lai cac icon
	 */
	public ImageIcon getImage(String name) {
		try {
			return new ImageIcon(getClass().getResource(currentTheme + "/" + name + imageExtension));
		} catch (Exception e) {
			JOptionPane.showMessageDialog(null, "Error. Please reinstall JCG");
			return null;
		}
	}
}